InĀ [1]:
import pandas as pd
import plotly.graph_objects as go
InĀ [2]:
def plot(df3):
    # Create the plot
    fig = go.Figure()

    # Add a scatter trace
    fig.add_trace(go.Scatter(
        x=df3['date'],
        y=df3['TVLMC'],
        mode='lines',
        name='TVLMC',  # Legend name
    ))

    fig.data[-1].hovertemplate = 'Date: %{x|%Y-%m-%d}<br>TVLMC: %{y:.2f}<extra></extra>'

    # Update layout with centered title and axis labels
    fig.update_layout(
        title={
            'text': "Ethereum TVLMC",
            'x': 0.5,  # Center the title horizontally
            'y': 0.95,  # Position it near the top vertically
            'xanchor': 'center',  # Anchor to center
            'yanchor': 'top'  # Anchor to top
        },
        xaxis_title='Date',
        yaxis_title='TVLMC',
        legend_title_text='Legend',
    )

    # Show the figure
    fig.show()
    return fig
InĀ [3]:
df3 = pd.read_csv('../data/ETH-MCAP-TVL-ratios.csv')
figure = plot(df3)
InĀ [4]:
output_file = 'interactive_plot.html'
figure.write_html(output_file)